/*
 * DetailFrame.java
 *
 * Created on __DATE__, __TIME__
 */

package com.insigma.yanwenlong.bookkeeping.gui;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.sql.SQLException;
import java.util.List;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

import com.insigma.yanwenlong.bookkeeping.pojo.Account;
import com.insigma.yanwenlong.bookkeeping.pojo.Category;
import com.insigma.yanwenlong.bookkeeping.pojo.DetailCondition;
import com.insigma.yanwenlong.bookkeeping.pojo.Direction;
import com.insigma.yanwenlong.bookkeeping.pojo.Member;
import com.insigma.yanwenlong.bookkeeping.pojo.vo.DetailVo;
import com.insigma.yanwenlong.bookkeeping.service.AccountService;
import com.insigma.yanwenlong.bookkeeping.service.AccountServiceImpl;
import com.insigma.yanwenlong.bookkeeping.service.CategoryService;
import com.insigma.yanwenlong.bookkeeping.service.CategoryServiceImpl;
import com.insigma.yanwenlong.bookkeeping.service.DetailService;
import com.insigma.yanwenlong.bookkeeping.service.DetailServiceImpl;
import com.insigma.yanwenlong.bookkeeping.service.DirectionService;
import com.insigma.yanwenlong.bookkeeping.service.DirectionServiceImpl;
import com.insigma.yanwenlong.bookkeeping.service.MemberService;
import com.insigma.yanwenlong.bookkeeping.service.MemberServiceImpl;

/**
 *
 * @author  __USER__
 */
public class DetailFrame extends javax.swing.JFrame {

	private DetailService detailService = new DetailServiceImpl();
	private CategoryService categoryService = new CategoryServiceImpl();
	private AccountService accountService = new AccountServiceImpl();
	private DirectionService directionService = new DirectionServiceImpl();
	private MemberService memberService = new MemberServiceImpl();
	private DefaultTableModel dtm;

	/** Creates new form DetailFrame */
	public DetailFrame() {
		this.setTitle("账务管理");
		initComponents();
		//居中
		this.setLocationRelativeTo(null);
		//关闭此窗体而不关闭父窗体
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		//初始化界面上的账务信息
		initDetail();
		//初始化界面上的账户名称
		initAccountName();
		//初始化界面上的收支
		initDirection();
		//初始化界面上的类别
		initCategory();
	}

	private void initCategory() {
		try {
			List<Category> categories = categoryService.findCategories();
			DefaultComboBoxModel dcbm = (DefaultComboBoxModel) cobCategory
					.getModel();
			for (Category category : categories) {
				dcbm.addElement(category);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	private void initDirection() {
		try {
			List<Direction> directions = directionService.findDirections();
			DefaultComboBoxModel dcbm = (DefaultComboBoxModel) cobDirection
					.getModel();
			for (Direction direction : directions) {
				dcbm.addElement(direction);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	private void initAccountName() {
		try {
			List<Account> accounts = accountService.findaAccounts();
			DefaultComboBoxModel dcbm = (DefaultComboBoxModel) cobAccount
					.getModel();
			for (Account account : accounts) {
				dcbm.addElement(account);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	private void initDetail() {
		Category category = null;
		try {
			List<DetailVo> detailVos = detailService.findDetails();
			dtm = (DefaultTableModel) tblDetail.getModel();
			double outcome = 0;
			double income = 0;
			for (DetailVo detailVo : detailVos) {
				category = categoryService.findDirectionIdById(detailVo
						.getCategoryId());
				//1代表支出      2代表收入
				if (category.getDirectionId() == 1) {
					outcome += detailVo.getHappenMoney();
					dtm.addRow(new Object[] { detailVo.getId(),
							detailVo.getAccountName(), detailVo.getTranTime(),
							"", "-" + detailVo.getHappenMoney(),
							detailVo.getCategoryName(),
							detailVo.getMemberName(), detailVo.getNote() });
				} else {
					income += detailVo.getHappenMoney();
					dtm.addRow(new Object[] { detailVo.getId(),
							detailVo.getAccountName(), detailVo.getTranTime(),
							detailVo.getHappenMoney(), "",
							detailVo.getCategoryName(),
							detailVo.getMemberName(), detailVo.getNote() });
				}
			}

			lblIncome.setText(String.valueOf(income));
			lblOutcome.setText(String.valueOf(outcome));
			lblTotal.setText(String.valueOf(income - outcome));
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		btnOutcome = new javax.swing.JButton();
		btnIncome = new javax.swing.JButton();
		jLabel1 = new javax.swing.JLabel();
		cobAccount = new javax.swing.JComboBox();
		jLabel2 = new javax.swing.JLabel();
		jComboBox2 = new javax.swing.JComboBox();
		jLabel3 = new javax.swing.JLabel();
		jtfStartTime = new javax.swing.JTextField();
		jLabel4 = new javax.swing.JLabel();
		jtfStopTime = new javax.swing.JTextField();
		jLabel5 = new javax.swing.JLabel();
		cobDirection = new javax.swing.JComboBox();
		jLabel6 = new javax.swing.JLabel();
		cobCategory = new javax.swing.JComboBox();
		jLabel7 = new javax.swing.JLabel();
		jtfNote = new javax.swing.JTextField();
		btnSearch = new javax.swing.JButton();
		btnExport = new javax.swing.JButton();
		jScrollPane1 = new javax.swing.JScrollPane();
		tblDetail = new javax.swing.JTable();
		btnDeUpdate = new javax.swing.JButton();
		btnDeDelete = new javax.swing.JButton();
		jLabel8 = new javax.swing.JLabel();
		lblIncome = new javax.swing.JLabel();
		jLabel10 = new javax.swing.JLabel();
		lblOutcome = new javax.swing.JLabel();
		jLabel12 = new javax.swing.JLabel();
		lblTotal = new javax.swing.JLabel();
		btnReset = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

		btnOutcome.setText("\u652f\u51fa");
		btnOutcome.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnOutcomeActionPerformed(evt);
			}
		});

		btnIncome.setText("\u6536\u5165");
		btnIncome.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnIncomeActionPerformed(evt);
			}
		});

		jLabel1.setText("\u8d26\u6237");

		cobAccount.setModel(new javax.swing.DefaultComboBoxModel(
				new String[] { "请选择" }));

		jLabel2.setText("\u65f6\u95f4");

		jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(
				new String[] { "自定义" }));

		jLabel3.setText("\u4ece");

		jLabel4.setText("\u5230");

		jLabel5.setText("\u6536\u652f");

		cobDirection.setModel(new javax.swing.DefaultComboBoxModel(
				new String[] { "请选择" }));

		jLabel6.setText("\u7c7b\u522b");

		cobCategory.setModel(new javax.swing.DefaultComboBoxModel(
				new String[] { "请选择" }));

		jLabel7.setText("\u8bf4\u660e");

		btnSearch.setText("\u67e5\u8be2");
		btnSearch.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnSearchActionPerformed(evt);
			}
		});

		btnExport.setText("\u5bfc\u51fa");
		btnExport.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnExportActionPerformed(evt);
			}
		});

		tblDetail.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {

				}, new String[] { "编号", "账户", "交易日期", "收入", "支出", "类别", "家庭成员",
						"说明" }) {
			boolean[] canEdit = new boolean[] { false, false, false, false,
					false, false, false, false };

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		jScrollPane1.setViewportView(tblDetail);

		btnDeUpdate.setText("\u4fee\u6539");
		btnDeUpdate.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnDeUpdateActionPerformed(evt);
			}
		});

		btnDeDelete.setText("\u5220\u9664");
		btnDeDelete.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnDeDeleteActionPerformed(evt);
			}
		});

		jLabel8.setText("\u6d41\u5165\uff1a");

		lblIncome.setText("1000");

		jLabel10.setText("\u6d41\u51fa\uff1a");

		lblOutcome.setText("2000");

		jLabel12.setText("\u5dee\u989d\uff1a");

		lblTotal.setText("-1000");

		btnReset.setText("\u5237\u65b0");
		btnReset.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnResetActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout
				.setHorizontalGroup(layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addGap(23, 23, 23)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel5)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				cobDirection,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				jLabel6)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				cobCategory,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				jLabel7)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				jtfNote,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				83,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				btnSearch)
																		.addGap(
																				28,
																				28,
																				28)
																		.addComponent(
																				btnExport)
																		.addContainerGap())
														.addGroup(
																layout
																		.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																		.addGroup(
																				layout
																						.createSequentialGroup()
																						.addComponent(
																								btnOutcome)
																						.addGap(
																								31,
																								31,
																								31)
																						.addComponent(
																								btnIncome)
																						.addGap(
																								36,
																								36,
																								36)
																						.addComponent(
																								btnReset)
																						.addContainerGap())
																		.addGroup(
																				layout
																						.createSequentialGroup()
																						.addComponent(
																								jLabel1,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								40,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addPreferredGap(
																								javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																						.addComponent(
																								cobAccount,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addGap(
																								18,
																								18,
																								18)
																						.addComponent(
																								jLabel2)
																						.addGap(
																								18,
																								18,
																								18)
																						.addComponent(
																								jComboBox2,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addGap(
																								12,
																								12,
																								12)
																						.addComponent(
																								jLabel3)
																						.addPreferredGap(
																								javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																						.addComponent(
																								jtfStartTime,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								86,
																								Short.MAX_VALUE)
																						.addPreferredGap(
																								javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																						.addComponent(
																								jLabel4)
																						.addPreferredGap(
																								javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																						.addComponent(
																								jtfStopTime,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								95,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addGap(
																								89,
																								89,
																								89)))))
						.addGroup(
								layout.createSequentialGroup().addGap(51, 51,
										51).addComponent(btnDeUpdate).addGap(
										69, 69, 69).addComponent(btnDeDelete)
										.addContainerGap(341, Short.MAX_VALUE))
						.addGroup(
								layout
										.createSequentialGroup()
										.addGap(236, 236, 236)
										.addComponent(jLabel8)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(lblIncome)
										.addGap(18, 18, 18)
										.addComponent(jLabel10)
										.addGap(18, 18, 18)
										.addComponent(lblOutcome)
										.addGap(18, 18, 18)
										.addComponent(jLabel12)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(lblTotal)
										.addContainerGap(87, Short.MAX_VALUE))
						.addGroup(
								layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane1,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												555, Short.MAX_VALUE)
										.addContainerGap()));
		layout
				.setVerticalGroup(layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addGap(28, 28, 28)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																btnOutcome)
														.addComponent(btnIncome)
														.addComponent(btnReset))
										.addGap(26, 26, 26)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel1)
														.addComponent(
																cobAccount,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel2)
														.addComponent(
																jComboBox2,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel4)
														.addComponent(
																jtfStopTime,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(
																jtfStartTime,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel3))
										.addGap(18, 18, 18)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel5)
														.addComponent(
																cobDirection,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel6)
														.addComponent(
																cobCategory,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel7)
														.addComponent(
																jtfNote,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(btnSearch)
														.addComponent(btnExport))
										.addGap(18, 18, 18)
										.addComponent(
												jScrollPane1,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												234,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addGap(18, 18, 18)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel8)
														.addComponent(lblIncome)
														.addComponent(jLabel10)
														.addComponent(
																lblOutcome)
														.addComponent(jLabel12)
														.addComponent(lblTotal))
										.addGap(31, 31, 31)
										.addGroup(
												layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																btnDeDelete)
														.addComponent(
																btnDeUpdate))
										.addContainerGap(35, Short.MAX_VALUE)));

		pack();
	}// </editor-fold>
	//GEN-END:initComponents
	
	//点击刷新
	private void btnResetActionPerformed(java.awt.event.ActionEvent evt) {
		dtm.setRowCount(0);
		initDetail();
	}

	//点击收入,添加收入
	private void btnIncomeActionPerformed(java.awt.event.ActionEvent evt) {
		new IncomeOrOutcomeFrame(btnIncome).setVisible(true);
	}

	//点击支出，添加支出
	private void btnOutcomeActionPerformed(java.awt.event.ActionEvent evt) {
		new IncomeOrOutcomeFrame(btnOutcome).setVisible(true);
	}

	//点击删除
	private void btnDeDeleteActionPerformed(java.awt.event.ActionEvent evt) {
		if (tblDetail.isRowSelected(tblDetail.getSelectedRow())) {
			int rowAffected = 0;
			int[] rowCount = tblDetail.getSelectedRows();
			for (int i : rowCount) {
				int id = (Integer) tblDetail.getValueAt(i, 0);
				try {
					rowAffected = detailService.deleteDetailById(id);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			if (rowAffected > 0) {
				JOptionPane.showMessageDialog(this, "删除账务信息成功");
			} else {
				JOptionPane.showMessageDialog(this, "删除账务信息失败");
			}
		} else {
			JOptionPane.showMessageDialog(this, "你没有选择行");
		}
	}

	//点击修改
	private void btnDeUpdateActionPerformed(java.awt.event.ActionEvent evt) {
		if (tblDetail.isRowSelected(tblDetail.getSelectedRow())) {
			if (tblDetail.getSelectedRowCount() == 1) {
				new DetailUpdateFrame(tblDetail).setVisible(true);
			} else {
				JOptionPane.showMessageDialog(this, "你选择多行,请选择一行");
			}
		} else {
			JOptionPane.showMessageDialog(this, "你没有选择行");
		}

	}

	//点击导出，将界面上的信息导入到指定的文件中
	private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {
		int row = dtm.getRowCount();
		int column = dtm.getColumnCount();
		String[] information = new String[row];
		for (int i = 0; i < row; i++) {
			information[i] = "";
			for (int j = 0; j < column; j++) {
				information[i] += dtm.getValueAt(i, j) + "\t";
			}
			information[i] += "\n";
		}
		File file = new File("D:/账务信息.txt");
		OutputStreamWriter osw = null;
		String s = null;
		try {
			osw = new OutputStreamWriter(new FileOutputStream(file));
			for (int index = 0; index < row; index++) {
				try {
					s = information[index].replace("\n", "\r\n");
					osw.write(s);
					osw.flush();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} finally {
			try {
				osw.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

	//点击查询
	private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {
		int accountId = -1;
		if (cobAccount.getSelectedItem() instanceof Account) {
			Account account = (Account) cobAccount.getSelectedItem();
			accountId = account.getId();
		}

		String startDate = jtfStartTime.getText();
		String stopDate = jtfStopTime.getText();

		int categoryId = -1;
		if (cobCategory.getSelectedItem() instanceof Category) {
			Category category = (Category) cobCategory.getSelectedItem();
			categoryId = category.getId();
		}

		int directionId = -1;
		if (cobDirection.getSelectedItem() instanceof Direction) {
			Direction direction = (Direction) cobDirection.getSelectedItem();
			directionId = direction.getId();
		}

		String note = jtfNote.getText();

		DetailCondition detailCondition = new DetailCondition();
		detailCondition.setAccountId(accountId);
		detailCondition.setCategoryId(categoryId);
		detailCondition.setDirectionId(directionId);
		detailCondition.setNote(note);
		detailCondition.setStartDate(startDate);
		detailCondition.setStopDate(stopDate);

		dtm.setRowCount(0);

		initDetailByConditions(detailCondition);
	}

	private void initDetailByConditions(DetailCondition detailCondition) {
		Category category = null;
		Account account = null;
		Member member = null;
		try {
			List<DetailCondition> detailConditions = detailService
					.findDetailsByConditions(detailCondition);
			dtm = (DefaultTableModel) tblDetail.getModel();
			double outcome = 0;
			double income = 0;
			for (DetailCondition detailCondition1 : detailConditions) {
				category = categoryService.findDirectionIdById(detailCondition1
						.getCategoryId());
				account = accountService.findAccountById(detailCondition1
						.getAccountId());
				member = memberService.findMemberById(detailCondition1
						.getMemberId());
				//1代表支出      2代表收入
				if (category.getDirectionId() == 1) {
					outcome += detailCondition1.getHappenMoney();
					dtm.addRow(new Object[] { detailCondition1.getId(),
							account.getName(), detailCondition1.getTranTime(),
							"", "-" + detailCondition1.getHappenMoney(),
							category.getCategoryName(), member.getName(),
							detailCondition1.getNote() });
				} else {
					income += detailCondition1.getHappenMoney();
					dtm.addRow(new Object[] { detailCondition1.getId(),
							account.getName(), detailCondition1.getTranTime(),
							detailCondition1.getHappenMoney(), "",
							category.getCategoryName(), member.getName(),
							detailCondition1.getNote() });
				}
			}

			lblIncome.setText(String.valueOf(income));
			lblOutcome.setText(String.valueOf(outcome));
			lblTotal.setText(String.valueOf(income - outcome));
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new DetailFrame().setVisible(true);
			}
		});
	}

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JButton btnDeDelete;
	private javax.swing.JButton btnDeUpdate;
	private javax.swing.JButton btnExport;
	private javax.swing.JButton btnIncome;
	private javax.swing.JButton btnOutcome;
	private javax.swing.JButton btnReset;
	private javax.swing.JButton btnSearch;
	private javax.swing.JComboBox cobAccount;
	private javax.swing.JComboBox cobCategory;
	private javax.swing.JComboBox cobDirection;
	private javax.swing.JComboBox jComboBox2;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel10;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JTextField jtfNote;
	private javax.swing.JTextField jtfStartTime;
	private javax.swing.JTextField jtfStopTime;
	private javax.swing.JLabel lblIncome;
	private javax.swing.JLabel lblOutcome;
	private javax.swing.JLabel lblTotal;
	private javax.swing.JTable tblDetail;
	// End of variables declaration//GEN-END:variables

}